package cn.outsourcing.supermarket.converter;

import cn.outsourcing.supermarket.converter.transform.BooleanToIntegerTransform;
import cn.outsourcing.supermarket.po.HiolabsOrderGoods;
import cn.outsourcing.supermarket.vo.OrderGoodsVO;
import cn.outsourcing.supermarket.vo.hiolabs.HiolabsOrderGoodsVO;
import org.mapstruct.IterableMapping;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 商品实体类映射器
 *
 * @author gzkemays
 * @since 2021/10/21 19:42
 */
@Mapper(uses = {BooleanToIntegerTransform.class})
public interface HiolabsOrderGoodsConverter {
  HiolabsOrderGoodsConverter INSTANCE = Mappers.getMapper(HiolabsOrderGoodsConverter.class);
  //    @Mappings({
  //            @Mapping(source = "id", target = "id"),
  //            @Mapping(source = "name", target = "name"),
  //            @Mapping(source = "goodsNumber", target = "goodsNumber"),
  //            @Mapping(source = "minRetailPrice", target = "minRetailPrice"),
  //            @Mapping(source = "goodsBrief", target = "goodsBrief"),
  //            @Mapping(source = "listPicUrl", target = "listPicUrl")
  //    })

  /**
   * 转化为自身值对象
   *
   * @param orderGoods 原 po 类
   * @return 自身值对象
   */
  HiolabsOrderGoodsVO convertToVo(HiolabsOrderGoods orderGoods);
  /**
   * 转化为自身值对象列表
   *
   * @param list 原 po 类
   * @return 自身值对象列表
   */
  List<HiolabsOrderGoodsVO> convertToVoList(List<HiolabsOrderGoods> list);
  /**
   * 返回订单商品
   *
   * @param list 原对象集合
   * @return VO对象集合
   */
  @IterableMapping(elementTargetType = HiolabsOrderGoods.class)
  List<OrderGoodsVO> convertToOrderGoods(List<HiolabsOrderGoods> list);
}
